[PATCH 1/2] lib/pty: Put master PTY into non-blocking mode and buffer its output...
authorнаб <nabijaczleweli@nabijaczleweli.xyz>
Tue, 12 Apr 2022 14:25:14 +0000 (16:25 +0200)
committerChris Hofstaedtler <zeha@debian.org>
Sat, 19 Nov 2022 15:48:44 +0000 (15:48 +0000)
commit75321b8d669db5acc6db0bb9e57001606b15a351
treed73db3417e7f3e6da21db6c02afb012bfa2edaac
parente9a064d242881b0348f749d9e9df9be5c18b9ab1
[PATCH 1/2] lib/pty: Put master PTY into non-blocking mode and buffer its output to avoid deadlock

If we filled the script->child buffer before the child had a chance to read any
input, we'd sleep forever in write_all(pty->master), and the child would sleep
forever in write(1<pty->slave>)

By putting the master PTY in non-blocking mode, we can poll(pty->master,
POLLOUT) and keep supplying more data as the child reads from the buffer

Fixes Debian bug #1003095

Signed-off-by: Karel Zak <kzak@redhat.com>
Gbp-Pq: Topic upstream
Gbp-Pq: Name PATCH-1-2-lib-pty-Put-master-PTY-into-non-blocking-mode-a.patch
include/pty-session.h
lib/pty-session.c